home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_9.lha
/
5_9
/
5_9c3.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
518b
|
28 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
ain(int argc, char *argv[])
srand(1); // DELETE
if (argc != 3)
error("two arguments expected");
int count = 0;
int m = atoi(argv[1]); // number of set members
int n = atoi(argv[2]); // in the range 1..n
intset s(m,n);
while (count < m)
{
int t = randint(n);
if (s.member(t) == 0)
{
s.insert(t);
count++;
}
}
print_in_order(&s);